<?php
function removeSpecs($specsId, $arySpecs){
    
    foreach ($arySpecs as $key => $value) {
        if($specsId != $value){
            $aryTem[] = $value;
        }
    }

    if(isset ($aryTem[0])){
        $specs = implode(':', $aryTem);
        $strSpecs = 'specs:'.$specs;
    }else{
        $strSpecs = 'specs';
    }
    return $strSpecs;
}
?>
<?php if(is_array($arySpecs)) {?>
<?php foreach ($arySpecs as $key => $value) {?>
    <div class="specs_detail_header"><?php echo $value['specs_name'];?></div>
    <?php if(is_array($value['sub_specs'])) {?>
        <?php foreach ($value['sub_specs'] as $key => $subSpecs) {?>
        <div class="specs_detail_top">
            <?php echo $subSpecs['specs_name'];?>
        </div>
        <?php if(is_array($subSpecs['sub_specs_3'])){?>
            <?php foreach ($subSpecs['sub_specs_3'] as $key => $subLevel3) {?>
                <?php if(in_array($subLevel3['specs_id'], $arySpecsId)){?>
                    <div class="specs_detail"><?php echo $subLevel3['specs_name'];?><a href="/danhmuc/<?php echo $categoryId;?>/<?php echo $categoryNameFilter;?>/<?php echo $makerName;?>/<?php echo $filterPrice;?>/<?php echo removeSpecs($subLevel3['specs_id'], $arySpecsId);?>/"><img src="/public/images/form/delete.png" title="Xóa lựa chọn này"></a></div>
                <?php }else{?>
                    <div class="specs_detail"><a href="/danhmuc/<?php echo $categoryId;?>/<?php echo $categoryNameFilter;?>/<?php echo $makerName;?>/<?php echo $filterPrice;?>/<?php echo $strSpecs;?>:<?php echo $subLevel3['specs_id'];?>/"><?php echo $subLevel3['specs_name'];?>&nbsp;&nbsp;(<?php echo $subLevel3['specs_count'];?>)</a></div>
                <?php } ?>
            <?php } ?>
        <?php } ?>
    

        <?php }?>
    <?php } ?>
<?php } ?>
<?php }?>
    